{include file="public/header" /}
<body>
<div class="layui-tab layui-tab-brief main-tab-container">
  <ul class="layui-tab-title main-tab-title">
    <li class="layui-this">文章添加</li>
    <div class="main-tab-item">内容管理</div>
  </ul>
  <div class="layui-tab-content">
    <form class="layui-form" onsubmit="return false;">
      <div class="layui-tab-item layui-show">
        <div class="layui-form-item">
          <label class="layui-form-label">标题</label>
          <div class="layui-input-inline input-custom-width">
            <input type="text" name="title" value="" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">所属栏目</label>
          <div class="layui-input-inline input-custom-width">
            <select name="cate_id" lay-verify="required">
              {volist name="cate" id="vo"}
              <option value="{$vo.cate_id}">{$vo.name}</option>
              {/volist}
            </select>
          </div>
          <div class="layui-form-mid layui-word-aux"></div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">文章描述</label>
          <div class="layui-input-inline input-custom-width">
            <textarea name="description" required lay-verify="required" placeholder="请输入文章描述" class="layui-textarea"></textarea>
          </div>
          <div class="layui-form-mid layui-word-aux"></div>
        </div>
        <!--<div class="layui-form-item">-->
          <!--<label class="layui-form-label">发布时间</label>-->
          <!--<div class="layui-input-inline input-custom-width">-->
            <!--<input type="text" name="create_time" value="2017-02-24 21:47:42" id="date" lay-verify="datetime" placeholder="YYYY-MM-DD hh:mm:ss" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this,istime: 1, format: 'YYYY-MM-DD hh:mm:ss' })">-->
          <!--</div>-->
        <!--</div>-->

        <div class="layui-form-item">
          <label class="layui-form-label">作者</label>
          <div class="layui-input-inline input-custom-width">
            <input type="text" name="author" required lay-verify="required" placeholder="默认为当前管理员" autocomplete="off" class="layui-input" value="{$Think.session.username}">
          </div>
          <div class="layui-form-mid layui-word-aux"></div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">文章内容</label>
          <div class="layui-input-block" style="z-index:100">
            <script id="container" name="content" type="text/plain" style="width:600px;height:500px;"></script>
            <input type="hidden" name="create_time" >
            <input type="hidden" name="update_time" >
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="feedback_edit" id="sbtn">立即添加</button>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__ue/ueditor.config.js"></script>
  <!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__ue/ueditor.all.js"></script>
<script type="text/javascript">
    layui.use('upload', function(){
        layui.upload(options);
    });
    var ue = UE.getEditor('container');
    //添加操作
      $(".layui-btn").click(function(){
        $.ajax({
            url: "{:url('article/add_article')}",
            data: $("form").serialize(),
            type: "POST",
            datatype:"json",
            success: function( result ) {
                layer.open({
                    title: '信息'
                    ,content: '添加成功！'
                });
            }
        });
    });
</script>
<script type="text/javascript">
    layui.use(['element', 'form', 'upload', 'layedit', 'laydate'], function(){
        var element = layui.element()
            ,form = layui.form()
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,jq = layui.jquery;
    })
</script>
</body>
</html>